<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>成像数据管理</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.7 -->
  <link rel="stylesheet" href="../static/bower_components/bootstrap/dist/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="../static/bower_components/font-awesome/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="../static/bower_components/Ionicons/css/ionicons.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="../static/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../static/dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="../static/dist/css/skins/_all-skins.min.css">
  <!-- daterange picker -->
  <link rel="stylesheet" href="../static/bower_components/bootstrap-daterangepicker/daterangepicker.css">
  <!-- bootstrap datepicker -->
  <link rel="stylesheet" href="../static/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
  <!-- iCheck for checkboxes and radio inputs -->
  <link rel="stylesheet" href="../static/plugins/iCheck/all.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="../static/bower_components/select2/dist/css/select2.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../static/dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="../static/dist/css/skins/_all-skins.min.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Google Font -->
  <link rel="stylesheet"
        href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

  <header class="main-header">
    <!-- Logo -->
    <a href="#" class="logo">
      <!-- mini logo for sidebar mini 50x50 pixels -->
      <span class="logo-mini">超</span>
      <!-- logo for regular state and mobile devices -->
      <span class="logo-lg">超声波成像系统平台</span>
    </a>
    <!-- Header Navbar: style can be found in header.less -->
    <nav class="navbar navbar-static-top">
      <!-- Sidebar toggle button-->
      <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>

      <div class="navbar-custom-menu">
        <ul class="nav navbar-nav">
          <!--导航栏信息，已经删除-->
        </ul>
      </div>
    </nav>
  </header>
  <!-- Left side column. contains the logo and sidebar -->
  <aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
      <!-- Sidebar user panel -->
      <!-- search form -->
      <!-- /.search form -->
      <!-- sidebar menu: : style can be found in sidebar.less -->
      <ul class="sidebar-menu" data-widget="tree">
        <li><a href="${pageContext.request.contextPath}/main/medicalRecords"><i class="fa fa-circle-o"></i>
          病人病历管理</a></li>
        <li><a href="${pageContext.request.contextPath}/main/medicalRecordsAnalysis"><i
                class="fa fa-circle-o"></i> 病人数据统计分析管理</a></li>
        <li><a href="${pageContext.request.contextPath}/main/imagingData"><i class="fa fa-circle-o"></i> 成像数据管理</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/projectManage"><i class="fa fa-circle-o"></i> 项目管理</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/commentManage"><i class="fa fa-circle-o"></i>
          评价体系管理</a></li>
        <li><a href="${pageContext.request.contextPath}/main/logManage"><i class="fa fa-circle-o"></i> 平台日志信息管理</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/consumableMaterial"><i class="fa fa-circle-o"></i>
          平台耗材管理</a></li>
        <li><a href="${pageContext.request.contextPath}/main/userManage"><i class="fa fa-circle-o"></i>
          平台用户及权限管理</a></li>
        <li><a href="${pageContext.request.contextPath}/main/platformPortal"><i class="fa fa-circle-o"></i>
          超声波成像系统平台门户</a></li>
        <li><a href="${pageContext.request.contextPath}/main/sendControl"><i class="fa fa-circle-o"></i> 多通道发射控制</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/receiveControl"><i class="fa fa-circle-o"></i>
          多通道接收控制</a></li>
        <li><a href="${pageContext.request.contextPath}/main/syncControl"><i class="fa fa-circle-o"></i> 外部同步控制</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/dataCollect"><i class="fa fa-circle-o"></i> 数据采集与重建</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/waveGenerate"><i class="fa fa-circle-o"></i> 任意波束形成</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/scriptManage"><i class="fa fa-circle-o"></i>
          超声探头脚本管理</a></li>
        <li><a href="${pageContext.request.contextPath}/main/createImgAlgorithm"><i class="fa fa-circle-o"></i>
          成像模式算法</a></li>
        <li><a href="${pageContext.request.contextPath}/main/resolveImgAlgorithm"><i class="fa fa-circle-o"></i>
          图像处理算法</a></li>
        <li><a href="${pageContext.request.contextPath}/main/patientManage"><i class="fa fa-circle-o"></i>
          病人信息管理</a></li>
      </ul>
    </section>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        成像数据管理
        <small>详细信息</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
        <li><a href="#">成像数据管理</a></li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-xs-2"></div>
        <div class="col-xs-8">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title"><b>成像数据管理表</b></h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding">

              <table class="table table-hover table-bordered"
                     style="word-break:break-all; word-wrap:break-all;" id="mytable">
                <thead>
                <tr>
                  <th>序号</th>
                  <th>时间</th>
                  <th>幅值</th>
                  <th>操作</th>
                </tr>
                </thead>
                <tbody id="listTable">
                <tr>
                  <td>1</td>
                  <td>0.0000579800</td>
                  <td>0.0000580000</td>
                  <td>
                    <input type="button" name="" value="删除" class="btn btn-danger"
                           onclick="del(this)"/>
                  </td>
                </tr>
                </tbody>
              </table>
              <hr/>
              <h3>新增数据</h3>
              <form>
                <table class="table table-hover table-bordered">
                  <tr>
                    <th>时间</th>
                    <td><input type="text" name="" class="form-control" id="TbTime"/></td>
                  </tr>
                  <tr>
                    <th>幅值</th>
                    <td><input type="text" name="" class="form-control" id="TbValue"/></td>
                  </tr>
                  <tr>
                    <td colspan="2">
                      <input type="reset" value="重置" class="btn btn-primary" id="reset"/>
                      <input type="button" value="添加" class="btn btn-success" id="add"
                             onclick="addList()"/>
                    </td>
                  </tr>
                </table>
              </form>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <div class="col-xs-2"></div>
      </div>
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <footer class="main-footer">
    <div class="pull-right hidden-xs">
      <b>Version</b> 1.0.0
    </div>
    <strong>Copyright &copy; 2018 <a href="#">上海大学 </a>.</strong> All rights
    reserved.
  </footer>

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Create the tabs -->
    <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
      <li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
      <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
    </ul>
    <!-- Tab panes -->
    <div class="tab-content">
      <!-- Home tab content -->
      <div class="tab-pane" id="control-sidebar-home-tab">
        <h3 class="control-sidebar-heading">Recent Activity</h3>
        <ul class="control-sidebar-menu">
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-birthday-cake bg-red"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Langdon's Birthday</h4>

                <p>Will be 23 on April 24th</p>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-user bg-yellow"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4>

                <p>New phone +1(800)555-1234</p>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-envelope-o bg-light-blue"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4>

                <p>nora@example.com</p>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-file-code-o bg-green"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4>

                <p>Execution time 5 seconds</p>
              </div>
            </a>
          </li>
        </ul>
        <!-- /.control-sidebar-menu -->

        <h3 class="control-sidebar-heading">Tasks Progress</h3>
        <ul class="control-sidebar-menu">
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Custom Template Design
                <span class="label label-danger pull-right">70%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-danger" style="width: 70%"></div>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Update Resume
                <span class="label label-success pull-right">95%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-success" style="width: 95%"></div>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Laravel Integration
                <span class="label label-warning pull-right">50%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-warning" style="width: 50%"></div>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Back End Framework
                <span class="label label-primary pull-right">68%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-primary" style="width: 68%"></div>
              </div>
            </a>
          </li>
        </ul>
        <!-- /.control-sidebar-menu -->

      </div>
      <!-- /.tab-pane -->
      <!-- Stats tab content -->
      <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
      <!-- /.tab-pane -->
      <!-- Settings tab content -->
      <div class="tab-pane" id="control-sidebar-settings-tab">
        <form method="post">
          <h3 class="control-sidebar-heading">General Settings</h3>

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Report panel usage
              <input type="checkbox" class="pull-right" checked>
            </label>

            <p>
              Some information about this general settings option
            </p>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Allow mail redirect
              <input type="checkbox" class="pull-right" checked>
            </label>

            <p>
              Other sets of options are available
            </p>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Expose author name in posts
              <input type="checkbox" class="pull-right" checked>
            </label>

            <p>
              Allow the user to show his name in blog posts
            </p>
          </div>
          <!-- /.form-group -->

          <h3 class="control-sidebar-heading">Chat Settings</h3>

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Show me as online
              <input type="checkbox" class="pull-right" checked>
            </label>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Turn off notifications
              <input type="checkbox" class="pull-right">
            </label>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Delete chat history
              <a href="javascript:void(0)" class="text-red pull-right"><i class="fa fa-trash-o"></i></a>
            </label>
          </div>
          <!-- /.form-group -->
        </form>
      </div>
      <!-- /.tab-pane -->
    </div>
  </aside>
  <!-- /.control-sidebar -->
  <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<!-- jQuery 3 -->
<script src="../static/bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="../static/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="../static/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="../static/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="../static/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="../static/bower_components/fastclick/lib/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="../static/dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../static/dist/js/demo.js"></script>
<!-- page script -->
<!-- Select2 -->
<script src="../static/bower_components/select2/dist/js/select2.full.min.js"></script>
<!-- InputMask -->
<script src="../static/plugins/input-mask/jquery.inputmask.js"></script>
<script src="../static/plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="../static/plugins/input-mask/jquery.inputmask.extensions.js"></script>
<!-- date-range-picker -->
<script src="../static/bower_components/moment/min/moment.min.js"></script>
<script src="../static/bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
<!-- bootstrap datepicker -->
<script src="../static/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
<!-- bootstrap color picker -->
<script src="../static/bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"></script>
<!-- bootstrap time picker -->
<script src="../static/plugins/timepicker/bootstrap-timepicker.min.js"></script>
<!-- iCheck 1.0.1 -->
<script src="../static/plugins/iCheck/icheck.min.js"></script>
<!-- ChartJS -->
<script src="../static/bower_components/chart.js/Chart.js"></script>

<!--表单控制脚本-->
<script type="text/javascript">
    // 判断不含中文
    function checkNotCN(input) {
        var re = /[\u4e00-\u9fa5]/;
        if(re.test(input)) {
            alert("输入非法，请检查！");
            return false;
        }
        return true;
    }
    //add功能
    function addList() {
        var oTbTime = document.getElementById('TbTime').value;
        var oTbValue = document.getElementById('TbValue').value;
        if (!checkNotCN(oTbTime)) {
            return;
        }
        if (!checkNotCN(oTbValue)) {
            return;
        }


        // Todo
        $.post("${pageContext.request.contextPath}/main/addImagingData.do", {
            time: oTbTime,
            value: oTbValue
        }, function (result, status) {
            if (status === "success") {
                var oTr = document.createElement('tr');

                var oTd1 = document.createElement('td');
                oTd1.innerHTML = result.toString();

                var oTd2 = document.createElement('td');
                oTd2.innerHTML = oTbTime;

                var oTd3 = document.createElement('td');
                oTd3.innerHTML = oTbValue;

                var oTd4 = document.createElement('td');
                var oInput2 = document.createElement('input');
                oInput2.setAttribute('type', 'button');
                oInput2.setAttribute('value', '删除');
                oInput2.setAttribute('onclick', 'del(this)');
                oInput2.className = 'btn btn-danger';

                oTd4.appendChild(oInput2);

                oTr.appendChild(oTd1);
                oTr.appendChild(oTd2);
                oTr.appendChild(oTd3);
                oTr.appendChild(oTd4);

                var olistTable = document.getElementById('listTable');
                olistTable.appendChild(oTr);
            }
            else {
                alert("添加记录失败！！！")
            }
        })

    }

    //del单点功能
    function del(obj) {
        var oParentnode = obj.parentNode.parentNode;

        $.post("${pageContext.request.contextPath}/main/deleteImagingData.do", {
            id: oParentnode.cells[0].innerText.trim()
        }, function (result, status) {
            if (status === "success") {
                var olistTable = document.getElementById('listTable');
                olistTable.removeChild(oParentnode);
            }
            else {
                alert("删除记录失败！！！")
            }
        })


    }


</script>

<script>

    $(document).ready(function () {
        //do something
        getData();
    })

</script>

<script>
    function getData() {
        $.get("${pageContext.request.contextPath}/main/getImagingData.do", function (data, status) {
            if (status === 'success') {
                var olistTable = document.getElementById('listTable');

                let json = JSON.parse(data);

                for (var i = 0; i < json.length; i++) {
                    var tr = document.createElement('tr');
                    var tdPid = document.createElement('td');
                    tdPid.innerHTML = json[i].id;
                    var tdName = document.createElement('td');
                    tdName.innerHTML = json[i].time;
                    var tdDetail = document.createElement('td');
                    tdDetail.innerHTML = json[i].value;

                    var oTd4 = document.createElement('td');
                    var oInput2 = document.createElement('input');
                    oInput2.setAttribute('type', 'button');
                    oInput2.setAttribute('value', '删除');
                    oInput2.setAttribute('onclick', 'del(this)');
                    oInput2.className = 'btn btn-danger';

                    oTd4.appendChild(oInput2);

                    tr.appendChild(tdPid);
                    tr.appendChild(tdName);
                    tr.appendChild(tdDetail);
                    tr.appendChild(oTd4);

                    olistTable.appendChild(tr);
                }
            }

        });
    }
</script>

</body>
</html>